
const Router = require('koa-router')
const { app } = require(':share/webServer')

let useMidware = {    //包含路径的中间件引用器
    post: function (path, midware)
    {
        let router = new Router()
        router.post(path, midware)
        app.use(router.routes())
    },
    get: function (path, midware)
    {
        let router = new Router()
        router.get(path, midware)
        app.use(router.routes())
    },
    all: function (path, midware)
    {
        let router = new Router()
        router.all(path, midware)
        app.use(router.routes())
    },
}

module.exports = useMidware